import { http } from '@/utils/http'
import type { PageData } from '@/types/global'
import type { InvitationInfo, IzyActivitiesItem,
  IpointGoodsPageParam, IpointExchangeRecordsParam, IpointLogParam, 
IZyPointsMallGoodsItem,  ZyPointsExchangeRecordsItem, ZyPointsLogItem
 } from '@/types/points'

export const unlimitedQrcodeAPI = (data: any) => {
  return http({
    method: 'POST',
    url: `/sys/app/qrcode/generate-unlimited-qrcode?scene=${data.scene}`,
    data: {},
  })
}

export const saveInvitationRecordAPI = (data: any) => {
  return http<string>({
    method: 'POST',
    url: `/sys/app/invitations/saveInvitationRecord`,
    data,
  })
}
export const getMemberPointInfoAPI = (data: any) => {
  return http<InvitationInfo>({
    method: 'GET',
    url: `/sys/app/invitations/getMemberPointInfo`,
    data,
  })
}

export const getActivitiesInfoAPI = (name: String) => {
  return http<IzyActivitiesItem>({
    method: 'GET',
    url: `/sys/app/activities/${name}`,
    data: {},
  })
}

export const generateUrllinkAPI = (data: any) => {
  return http<string>({
    method: 'POST',
    url: `/sys/app/qrcode/generate_urllink`,
    data,
  })
}
export const appPointGoodsPageAPI = (data: IpointGoodsPageParam) => {
  return http<PageData<IZyPointsMallGoodsItem[]>>({
    method: 'POST',
    url: `/sys/app/points/appPointGoodsPage`,
    data,
  })
}
export const appPointExchangeRecordsPageAPI = (data: IpointExchangeRecordsParam) => {
  return http<PageData<ZyPointsExchangeRecordsItem[]>>({
    method: 'POST',
    url: `/sys/app/points/appPointExchangeRecordsPage`,
    data,
  })
}
export const appPointLogPageAPI = (data: IpointLogParam) => {
  return http<PageData<ZyPointsLogItem[]>>({
    method: 'POST',
    url: `/sys/app/points/appPointLogPage`,
    data,
  })
}
export const getInfoAPI = (data: any) => {
  return http<string>({
    method: 'GET',
    url: `/sys/app/points/info`,
    data,
  })
}
export const pointExchangeAPI = (data: any) => {
  return http<string>({
    method: 'POST',
    url: `/sys/app/points/pointExchange`,
    data,
  })
}
